/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : ButtonInterrupt.C
**     Project   : RTOSDemo
**     Processor : MC9S12C32CFU
**     Beantype  : ExtInt
**     Version   : Bean 02.025, Driver 01.06, CPU db: 2.87.276
**     Compiler  : Metrowerks HC12 C Compiler
**     Date/Time : 19/05/2005, 19:02
**     Abstract  :
**         This bean "ExtInt" implements an external 
**         interrupt, its control methods and interrupt/event 
**         handling procedure.
**         The bean uses one pin which generates interrupt on 
**         selected edge.
**     Settings  :
**         Interrupt name              : INT_PortP
**         User handling procedure     : ButtonInterrupt_OnInterrupt
**
**         Used pin                    : 
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       4             |  PP0_PWM0_KWP0
**             ----------------------------------------------------
**
**         Port name                   : P
**
**         Bit number (in port)        : 0
**         Bit mask of the port        : 1
**
**         Signal edge/level           : falling
**         Priority                    : 1
**         Pull option                 : up
**         Initial state               : Disabled
**
**         Edge register               : PPSP      [605]
**         Priority register           : HPRIO     [31]
**         Enable register             : PIEP      [606]
**         Request register            : PIFP      [607]
**
**         Port data register          : PTP       [600]
**         Port control register       : DDRP      [602]
**     Contents  :
**         Enable - void ButtonInterrupt_Enable(void);
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
** ###################################################################*/


/* MODULE ButtonInterrupt. */

#include "ButtonInterrupt.h"
/*Including shared modules, which are used for all project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PE_Timer.h"
#include "Events.h"
#include "Cpu.h"

/* Definition of DATA and CODE segments for this bean. User can specify where
   these segments will be located on "Build options" tab of the selected CPU bean. */
#pragma DATA_SEG ButtonInterrupt_DATA  /* Data section for this module. */
#pragma CODE_SEG ButtonInterrupt_CODE  /* Code section for this module. */

/*
** ===================================================================
**     Method      :  ButtonInterrupt_Enable (bean ExtInt)
**
**     Description :
**         Enable the bean - the external events are accepted.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void ButtonInterrupt_Enable(void)
{
  PIFP = 1;                             /* Clear flag */
  PIEP_PIEP0 = 1;                       /* Enable interrupt */
}

/*
** ===================================================================
**     Method      :  ButtonInterrupt_Interrupt (bean ExtInt)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
__interrupt void ButtonInterrupt_Interrupt(void)
{
  PIFP = 1;                             /* Clear flag */
  ButtonInterrupt_OnInterrupt();
}

#pragma CODE_SEG ButtonInterrupt_CODE  /* Code section for this module. */

/* END ButtonInterrupt. */

/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 03.33 for 
**     the Motorola HCS12 series of microcontrollers.
**
** ###################################################################
*/
